package edu.indiana.cs.b534.torrent.context;

import java.util.LinkedList;

public class RequestQueue {
        private LinkedList<RequestBean> queue = new LinkedList<RequestBean>();
    
        // Add work to the work queue
        public synchronized void addWork(RequestBean o) {
            queue.addLast(o);
            notify();
        }
    
        // Retrieve work from the work queue; block if the queue is empty
        public synchronized RequestBean getRequest() throws InterruptedException {
            while (queue.isEmpty()) {
                wait();
            }
            return queue.removeFirst();
        }
    
	
}
